        function initEvent(){
            var bgPage = chrome.extension.getBackgroundPage(), options = localStorage.gce_options ? JSON.parse(localStorage.gce_options) : {};
            //开关
            let inputs=document.getElementsByTagName('input');
            for(let i=0;i<inputs.length;i++) {
                let e=inputs[i],t;
                if(options[e.name] || options[e.name]==null) e.checked=true;
                //console.log(e);
                
                e.addEventListener("change",(ev)=>{
                    options[ev.target.name]=ev.target.checked?1:0;
                    console.log(ev.target.name+": "+ (ev.target.checked?"true":"false"));
                    //延迟5s保存  
                    if(t) clearInterval(t);
                    t=setTimeout(function(){
                            console.log(options);
                            localStorage.gce_options = JSON.stringify(options);    
                            bgPage.upOptions(options);
                    },2000)
                });
            }
            return;
            //别名
            if(options.keyMapAlias);
            let map={"折叠全部":"ctrl+shift+-","展开全部":"ctrl+shift++"},a=[],e=document.getElementById("mapalias"),t=null;
            for(let k in map)       a.push(`<p><b>${k}</b><span >${map[k]}</span></p>`)
            e.innerHTML=a.join("\n");
            
            let keys=e.querySelectorAll('span');
            for(let i=0;i<keys.length;i++) {
                keys[i].addEventListener('click',(ev)=>{
                    this.name=this.innerHTML;
                     e.setAttribute('contenteditable',true);
                     e.setAttribute('placeholder',"请按下快捷键");
                }).addEventListener('keyup',(ev)=>{
                        let k=keyMap.get(ev);
                        if(k=="esc") {
                            e.target('blur');
                            return clearInterval(t);
                        }
                        this.innerHTML=keyMap.get(ev);
                        t=setTimeout(()=>{
                            
                        },200)
                        return false;
                }).addEventListener('blur',(ev)=>{
                    e.setAttribute('contenteditable',false);
                });
                
            }
        }
addEventListener("load", initEvent, false);
